package com.filepublic.demo.common.result;

import lombok.Data;

@Data
public class Result<T> {

    private int errno;

    private String message;

    private T data;

    public static <T> Result<T> success(){
        Result result = new Result();
        result.errno = 1;
        return result;
    }

    public static <T> Result<T> success(T data){
        Result<T> result = new Result<>();
        result.errno = 1;
        result.data = data;
        return result;
    }

    public static <T> Result<T> error(String message){
        Result<T> result = new Result<>();
        result.errno = 0;
        result.message = message;
        return result;
    }

}
